<template>
  <div>
    <span>{{item.title}}</span>
    &nbsp;
    <span>(数量 {{item.quantity}})</span>
    &nbsp;
    <a href="#" @click.prevent="handleAdd(item.id)">增加</a>
    &nbsp;
    <a href="#" @click.prevent="handleDel(item.id)">减少</a>
  </div>
</template>

<script>
import event from '../event'
export default {
  props: {
    item: {
      type: Object
    }
  },
  methods: {
    handleAdd(id) {
      event.$emit('addToCart', id)
    },
    handleDel(id) {
      event.$emit('delFromCart', id)
    }
  }
}
</script>

<style>

</style>
